/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ru.jSky.selector;

import ru.jSky.finder.*;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import org.hamcrest.Matcher;
import org.hamcrest.Matchers;
import ru.jSky.factory.FilterFactory;
import ru.jSky.factory.MajorMatcherFactory;
import ru.jSky.filter.Filter;
import ru.jSky.interfaces.Enchantment;
import ru.jSky.interfaces.JSkyMod;
import ru.jSky.interfaces.Major;
import ru.jSky.support.RegexFactory;
import skyproc.GRUP_TYPE;

/**
 *
 * @author Rakev
 */
public abstract class AbstractFromModByEdidSelector<T extends Major> implements SelectorByEdid<T> {

    protected abstract Collection<T> getExistMajors();

    @Override
    public Collection<T> select(String regexEdid) {
        MajorMatcherFactory matcherFactory = new MajorMatcherFactory();
        Matcher<T> regexMatcher = matcherFactory.create(regexEdid);
        Filter<T> filter = new FilterFactory().create(regexMatcher);
        Collection<T> selected = filter.filter(getExistMajors());
        return selected;
    }

    @Override
    public Collection<T> select(String... regexEdids) {
        String totalRegex = new RegexFactory().anyOf(regexEdids);
        return select(totalRegex);
    }

    @Override
    public Collection<T> select(Collection<String> regexEdids) {
        String totalRegex = new RegexFactory().anyOf(regexEdids);
        return select(totalRegex);
    }
}
